<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">	
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="../images/yc.png" type="image/x-icon">
<link rel="stylesheet" href="../css/layui.css"  media="all">
</head>
<body>
<br/>
<form class="layui-form" action="" style="width:90%">
	<div class="layui-form-item">
    	<label class="layui-form-label">原密码</label>
    	<div class="layui-input-inline" style="width:50%">
     		<input type="password" name="password" lay-verify="pass" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
    	</div>
    	<div class="layui-form-mid layui-word-aux">请填写6到16位密码</div>
  	</div>
  	<div class="layui-form-item">
    	<label class="layui-form-label">新密码</label>
    	<div class="layui-input-inline" style="width:50%">
     		<input type="password" name="password" lay-verify="pass" placeholder="请输入新密码" autocomplete="off" class="layui-input">
    	</div>
    	<div class="layui-form-mid layui-word-aux">请填写6到16位新密码</div>
  	</div>
  	<div class="layui-form-item">
    	<label class="layui-form-label">确认密码</label>
    	<div class="layui-input-inline" style="width:50%">
     		<input type="password" name="password" lay-verify="pass" placeholder="请再次输入新密码" autocomplete="off" class="layui-input">
    	</div>
    	<div class="layui-form-mid layui-word-aux">请再次填写6到16位的新密码</div>
  	</div>
  	
  	<div class="layui-form-item">
    	<div class="layui-input-block">
      		<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
    	</div>
	</div>
</form>
          
<script type="text/javascript" src="../../js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="../js/layui.all.js" charset="utf-8"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
	var form = layui.form,
	layer = layui.layer,
	layedit = layui.layedit,
	laydate = layui.laydate;
  
	// 自定义验证规则
	form.verify({
		pass: [/^[\S]{6,12}$/, '密码必须6到16位，且不能出现空格...']
	});
  
	// 监听提交
  	form.on('submit(demo1)', function(data){
		layer.alert(JSON.stringify(data.field), {
      		title: '最终的提交信息'
    	})
		return false;
	});
});
</script>
</body>
</html>